package com.chuxuan.Math.Sort;

public class SelectSort extends Ordination{


        public SelectSort(Integer ar[]){
            System.out.println("-----------SelectSort-----------");
            Sort(ar);
        }

    @Override
    public void Sort(Integer[] ar) {
        Integer a[]=ar.clone();
        int position=0;
        for(int i=0;i<a.length;i++){

            int j=i+1;
            position=i;
            int temp=a[i];
            for(;j<a.length;j++){
                if(a[j]<temp){
                    temp=a[j];
                    position=j;
                }
            }
            a[position]=a[i];
            a[i]=temp;
        }

        this.ar=ar;
//		System.out.println(Arrays.toString( a));
    }
}
